'''
读文件相关的方法
'''
import os

import yaml  # pip install pyYAML

def get_project_path():
    cf = os.path.realpath(__file__)  # 当前文件的路径  readFile.py
    cd = os.path.dirname(cf)  # caw
    cd = os.path.dirname(cd) # futureloan
    return cd + "\\"

def read_yaml(path):
    path = get_project_path() + path
    with open(path, "r", encoding='utf-8') as f:
        content = f.read()
        a = yaml.load(content, Loader=yaml.FullLoader)
        return a

# 测试代码，用完可以删除
if __name__ == '__main__':
    a = read_yaml(r"data\register.yaml")
    print(a)